/**
 *
 */
package com.ssh.web;

import java.util.List;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.ssh.entity.Staff;
import com.ssh.ser.common.StaffInfoServiceI;

/**
 * @author jack
 *
 *
 */
public class ViewStaffAction extends ActionSupport {

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	private String request;
	public Staff staff;
	private StaffInfoServiceI staffInfoServiceI;

	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		try{
				String staffId = (String) ServletActionContext.getContext()
				.getSession().get("staffId");
	    Staff staff = staffInfoServiceI.editViewStaffInfo(staffId);
		setStaff(staff);
		ServletActionContext.getContext().getSession().put("staff", this.getStaff());
		System.out.println("staff viewStaffAction "+this.getStaff());

		}
	catch(Exception e){
		e.printStackTrace();
		return "error";
	}
		return "profile";
	}


	/**
	 * @return the request
	 */
	public String getRequest() {
		return request;
	}


	/**
	 * @param request the request to set
	 */
	public void setRequest(String request) {
		this.request = request;
	}


	/**
	 * @return the staff
	 */
	public Staff getStaff() {
		return staff;
	}

	/**
	 * @return the staffInfoServiceI
	 */
	public StaffInfoServiceI getStaffInfoServiceI() {
		return staffInfoServiceI;
	}

	/**
	 * @param staff
	 *            the staff to set
	 */
	public void setStaff(Staff staff) {
		this.staff = staff;
	}

	/**
	 * @param staffInfoServiceI
	 *            the staffInfoServiceI to set
	 */
	public void setStaffInfoServiceI(StaffInfoServiceI staffInfoServiceI) {
		this.staffInfoServiceI = staffInfoServiceI;
	}

}
